Compound motion-compensated prediction

ABSTRACT

A prediction scheme is selected for encoding or decoding a video block. A first compound motion block can be determined by weighting distances from a first reference frame to the video frame and from a second reference frame to the video frame using one or more quantized weighting coefficients. A second compound motion block can be determined based on an average of pixel values a video block of the first reference frame and pixel values from a video block of the second reference frame. One of the first compound motion block or the second compound motion block is selected and used to generate a prediction block. Alternatively, data encoded to a bitstream including the video frame can be used to determine which compound motion block to use to generate the prediction block. The current block of the video frame is then encoded or decoded using the prediction block.

BACKGROUND

Digital video streams may represent video using a sequence of frames orstill images. Digital video can be used for various applicationsincluding, for example, video conferencing, high definition videoentertainment, video advertisements, or sharing of user-generatedvideos. A digital video stream can contain a large amount of data andconsume a significant amount of computing or communication resources ofa computing device for processing, transmission, or storage of the videodata. Various approaches have been proposed to reduce the amount of datain video streams, including encoding or decoding techniques.

SUMMARY

A method for encoding a current block of a video frame according to animplementation of this disclosure comprises determining a first compoundmotion block by weighting distances from a first reference frame to thevideo frame and from a second reference frame to the video frame usingone or more quantized weighting coefficients. The method furthercomprises determining a second compound motion block based on an averageof pixel values from a video block of the first reference frame andpixel values from a video block of the second reference frame. Themethod further comprises selecting one of the first compound motionblock or the second compound motion block. The method further comprisesgenerating a prediction block using the selected one of the firstcompound motion block or the second compound motion block. The methodfurther comprises encoding the current block using the prediction block.

A method for decoding an encoded block of an encoded video frameaccording to an implementation of this disclosure comprises determining,based on one or more syntax elements encoded to a bitstream includingthe encoded video frame, whether the encoded block was encoded byweighting distances from each of a plurality of reference frames to theencoded video frame. The method further comprises, responsive todetermining that the encoded block was encoded by weighting thedistances from each of the plurality of reference frames to the encodedvideo frame, determining a compound motion block by weighting a firstdistance from a first reference frame to the encoded video frame and asecond distance from a second reference frame to the encoded video frameusing one or more quantized weighting coefficients. The method furthercomprises generating a prediction block using the compound motion block.The method further comprises decoding the encoded block using theprediction block.

An apparatus for decoding an encoded block of an encoded video frameaccording to an implementation of this disclosure comprises a processorconfigured to execute instructions stored in a non-transitory memory.The instructions include instructions to determine, based on one or moresyntax elements encoded to a bitstream including the encoded videoframe, whether the encoded block was encoded by weighting distances fromeach of a plurality of reference frames to the encoded video frame. Theinstructions further include instructions to, responsive to adetermination that the encoded block was encoded by weighting thedistances from each of the plurality of reference frames to the encodedvideo frame, determine a compound motion block by weighting a firstdistance from a first reference frame to the encoded video frame and asecond distance from a second reference frame to the encoded video frameusing one or more quantized weighting coefficients. The instructionsfurther include instructions to generate a prediction block using thecompound motion block. The instructions further include instructions todecode the encoded block using the prediction block.

These and other aspects of the present disclosure are disclosed in thefollowing detailed description of the embodiments, the appended claimsand the accompanying figures.

BRIEF DESCRIPTION OF THE DRAWINGS

The description herein makes reference to the accompanying drawingsdescribed below, wherein like reference numerals refer to like partsthroughout the several views.

FIG. 1 is a schematic of a video encoding and decoding system.

FIG. 2 is a block diagram of an example of a computing device that canimplement a transmitting station or a receiving station.

FIG. 3 is a diagram of a typical video stream to be encoded andsubsequently decoded.

FIG. 4 is a block diagram of an encoder according to implementations ofthis disclosure.

FIG. 5 is a block diagram of a decoder according to implementations ofthis disclosure.

FIG. 6 is a flowchart diagram of an example of a technique for encodinga video block using a selected prediction scheme.

FIG. 7 is a flowchart diagram of an example of a technique for decodingan encoded block using a selected prediction scheme.

FIG. 8 is an illustration of an example of distances between frames of avideo sequence.

FIG. 9 is a diagram of an example of a tree for determining quantizedweighted coefficients.

DETAILED DESCRIPTION

Video compression schemes may include breaking respective images, orvideo frames, into smaller portions, such as video blocks, andgenerating an encoded bitstream using techniques to limit theinformation included for respective video blocks thereof. The encodedbitstream can be decoded to re-create the source images from the limitedinformation. In some cases, compound motion prediction may be used topredict motion within a current video block by combining motioninformation for two or more reference frames.

For example, when two reference frames are used, a pixel values from ablock of each of those reference frames may be identified and averagedto determine a compound motion block to use to predict motion of thecurrent video block. However, this averaging-based prediction scheme maynot always result in the best performance for encoding or decoding thevideo sequence. For example, the reference frames may not be equidistantfrom the video frame including the current video block. As a result, theaveraging-based prediction scheme may not accurately reflect motionchanges in the video sequence.

Implementations of this disclosure include encoding or decoding a videoblock of a video frame by selecting an optimal compound motionprediction scheme. A first compound motion block can be determined byweighting distances from a first reference frame to the video frame andfrom a second reference frame to the video frame using one or morequantized weighting coefficients. A second compound motion block can bedetermined based on an average of pixel values from a video block of thefirst reference frame and pixel values from a video block of the secondreference frame. One of the first compound motion block or the secondcompound motion block is selected and used to generate a predictionblock. Alternatively, data encoded to a bitstream including the videoframe can be used to determine which compound motion block to use togenerate the prediction block. The video block of the video frame isthen encoded or decoded using the prediction block.

For example, during an encoding operation, an encoder can select one ofa distance-based prediction scheme (e.g., the first compound motionblock) or an averaging-based prediction scheme (e.g., the secondcompound motion block), such as based on rate-distortion valuestherefor, and encode data indicating the selection to a bitstream towhich the video block is encoded. During a decoding operation, a decodercan decode the encoded data from the bitstream to determine which of thedistance-based prediction scheme or averaging-based prediction scheme toselect for decoding the encoded block. As used herein, a compound motionblock may refer to a group of pixel values determined or otherwisecalculated based on a combination of two or more other groups of pixelvalues.

Further details of techniques for video coding using frame rotation aredescribed herein with initial reference to a system in which they can beimplemented. FIG. 1 is a schematic of a video encoding and decodingsystem 100. A transmitting station 102 can be, for example, a computerhaving an internal configuration of hardware such as that described inFIG. 2. However, other implementations of the transmitting station 102are possible. For example, the processing of the transmitting station102 can be distributed among multiple devices.

A network 104 can connect the transmitting station 102 and a receivingstation 106 for encoding and decoding of the video stream. Specifically,the video stream can be encoded in the transmitting station 102, and theencoded video stream can be decoded in the receiving station 106. Thenetwork 104 can be, for example, the Internet. The network 104 can alsobe a local area network (LAN), wide area network (WAN), virtual privatenetwork (VPN), cellular telephone network, or any other means oftransferring the video stream from the transmitting station 102 to, inthis example, the receiving station 106.

The receiving station 106, in one example, can be a computer having aninternal configuration of hardware such as that described in FIG. 2.However, other suitable implementations of the receiving station 106 arepossible. For example, the processing of the receiving station 106 canbe distributed among multiple devices.

Other implementations of the video encoding and decoding system 100 arepossible. For example, an implementation can omit the network 104. Inanother implementation, a video stream can be encoded and then storedfor transmission at a later time to the receiving station 106 or anyother device having memory. In one implementation, the receiving station106 receives (e.g., via the network 104, a computer bus, and/or somecommunication pathway) the encoded video stream and stores the videostream for later decoding. In an example implementation, a real-timetransport protocol (RTP) is used for transmission of the encoded videoover the network 104. In another implementation, a transport protocolother than RTP may be used (e.g., a Hypertext Transfer Protocol-based(HTTP-based) video streaming protocol).

When used in a video conferencing system, for example, the transmittingstation 102 and/or the receiving station 106 may include the ability toboth encode and decode a video stream as described below. For example,the receiving station 106 could be a video conference participant whoreceives an encoded video bitstream from a video conference server(e.g., the transmitting station 102) to decode and view and furtherencodes and transmits his or her own video bitstream to the videoconference server for decoding and viewing by other participants.

FIG. 2 is a block diagram of an example of a computing device 200 thatcan implement a transmitting station or a receiving station. Forexample, the computing device 200 can implement one or both of thetransmitting station 102 and the receiving station 106 of FIG. 1. Thecomputing device 200 can be in the form of a computing system includingmultiple computing devices, or in the form of one computing device, forexample, a mobile phone, a tablet computer, a laptop computer, anotebook computer, a desktop computer, and the like.

A processor 202 in the computing device 200 can be a conventionalcentral processing unit. Alternatively, the processor 202 can be anothertype of device, or multiple devices, capable of manipulating orprocessing information now existing or hereafter developed. For example,although the disclosed implementations can be practiced with oneprocessor as shown (e.g., the processor 202), advantages in speed andefficiency can be achieved by using more than one processor.

A memory 204 in computing device 200 can be a read only memory (ROM)device or a random access memory (RAM) device in an implementation.However, other suitable types of storage device can be used as thememory 204. The memory 204 can include code and data 206 that isaccessed by the processor 202 using a bus 212. The memory 204 canfurther include an operating system 208 and application programs 210,the application programs 210 including at least one program that permitsthe processor 202 to perform the techniques described herein. Forexample, the application programs 210 can include applications 1 throughN, which further include a video coding application that performs thetechniques described herein. The computing device 200 can also include asecondary storage 214, which can, for example, be a memory card usedwith a mobile computing device. Because the video communication sessionsmay contain a significant amount of information, they can be stored inwhole or in part in the secondary storage 214 and loaded into the memory204 as needed for processing.

The computing device 200 can also include one or more output devices,such as a display 218. The display 218 may be, in one example, a touchsensitive display that combines a display with a touch sensitive elementthat is operable to sense touch inputs. The display 218 can be coupledto the processor 202 via the bus 212. Other output devices that permit auser to program or otherwise use the computing device 200 can beprovided in addition to or as an alternative to the display 218. Whenthe output device is or includes a display, the display can beimplemented in various ways, including by a liquid crystal display(LCD), a cathode-ray tube (CRT) display, or a light emitting diode (LED)display, such as an organic LED (OLED) display.

The computing device 200 can also include or be in communication with animage-sensing device 220, for example, a camera, or any otherimage-sensing device 220 now existing or hereafter developed that cansense an image such as the image of a user operating the computingdevice 200. The image-sensing device 220 can be positioned such that itis directed toward the user operating the computing device 200. In anexample, the position and optical axis of the image-sensing device 220can be configured such that the field of vision includes an area that isdirectly adjacent to the display 218 and from which the display 218 isvisible.

The computing device 200 can also include or be in communication with asound-sensing device 222, for example, a microphone, or any othersound-sensing device now existing or hereafter developed that can sensesounds near the computing device 200. The sound-sensing device 222 canbe positioned such that it is directed toward the user operating thecomputing device 200 and can be configured to receive sounds, forexample, speech or other utterances, made by the user while the useroperates the computing device 200.

Although FIG. 2 depicts the processor 202 and the memory 204 of thecomputing device 200 as being integrated into one unit, otherconfigurations can be utilized. The operations of the processor 202 canbe distributed across multiple machines (wherein individual machines canhave one or more processors) that can be coupled directly or across alocal area or other network. The memory 204 can be distributed acrossmultiple machines such as a network-based memory or memory in multiplemachines performing the operations of the computing device 200. Althoughdepicted here as one bus, the bus 212 of the computing device 200 can becomposed of multiple buses. Further, the secondary storage 214 can bedirectly coupled to the other components of the computing device 200 orcan be accessed via a network and can comprise an integrated unit suchas a memory card or multiple units such as multiple memory cards. Thecomputing device 200 can thus be implemented in a wide variety ofconfigurations.

FIG. 3 is a diagram of an example of a video stream 300 to be encodedand subsequently decoded. The video stream 300 includes a video sequence302. At the next level, the video sequence 302 includes a number ofadjacent frames 304. While three frames are depicted as the adjacentframes 304, the video sequence 302 can include any number of adjacentframes 304. The adjacent frames 304 can then be further subdivided intoindividual frames, for example, a frame 306. At the next level, theframe 306 can be divided into a series of planes or segments 308. Thesegments 308 can be subsets of frames that permit parallel processing,for example. The segments 308 can also be subsets of frames that canseparate the video data into separate colors. For example, a frame 306of color video data can include a luminance plane and two chrominanceplanes. The segments 308 may be sampled at different resolutions.

Whether or not the frame 306 is divided into segments 308, the frame 306may be further subdivided into blocks 310, which can contain datacorresponding to, for example, 16×16 pixels in the frame 306. The blocks310 can also be arranged to include data from one or more segments 308of pixel data. The blocks 310 can also be of any other suitable sizesuch as 4×4 pixels, 8×8 pixels, 16×8 pixels, 8×16 pixels, 16×16 pixels,or larger. Unless otherwise noted, the terms block and macroblock areused interchangeably herein.

FIG. 4 is a block diagram of an encoder 400 according to implementationsof this disclosure. The encoder 400 can be implemented, as describedabove, in the transmitting station 102, such as by providing a computersoftware program stored in memory, for example, the memory 204. Thecomputer software program can include machine instructions that, whenexecuted by a processor such as the processor 202, cause thetransmitting station 102 to encode video data in the manner described inFIG. 4. The encoder 400 can also be implemented as specialized hardwareincluded in, for example, the transmitting station 102. In oneparticularly desirable implementation, the encoder 400 is a hardwareencoder.

The encoder 400 has the following stages to perform the variousfunctions in a forward path (shown by the solid connection lines) toproduce an encoded or compressed bitstream 420 using the video stream300 as input: an intra/inter prediction stage 402, a transform stage404, a quantization stage 406, and an entropy encoding stage 408. Theencoder 400 may also include a reconstruction path (shown by the dottedconnection lines) to reconstruct a frame for encoding of future blocks.In FIG. 4, the encoder 400 has the following stages to perform thevarious functions in the reconstruction path: a dequantization stage410, an inverse transform stage 412, a reconstruction stage 414, and aloop filtering stage 416. Other structural variations of the encoder 400can be used to encode the video stream 300.

When the video stream 300 is presented for encoding, respective adjacentframes 304, such as the frame 306, can be processed in units of blocks.At the intra/inter prediction stage 402, respective blocks can beencoded using intra-frame prediction (also called intra-prediction) orinter-frame prediction (also called inter-prediction). In any case, aprediction block can be formed. In the case of intra-prediction, aprediction block may be formed from samples in the current frame thathave been previously encoded and reconstructed. In the case ofinter-prediction, a prediction block may be formed from samples in oneor more previously constructed reference frames.

Next, the prediction block can be subtracted from the current block atthe intra/inter prediction stage 402 to produce a residual block (alsocalled a residual). The transform stage 404 transforms the residual intotransform coefficients in, for example, the frequency domain usingblock-based transforms. The quantization stage 406 converts thetransform coefficients into discrete quantum values, which are referredto as quantized transform coefficients, using a quantizer value or aquantization level. For example, the transform coefficients may bedivided by the quantizer value and truncated.

The quantized transform coefficients are then entropy encoded by theentropy encoding stage 408. The entropy-encoded coefficients, togetherwith other information used to decode the block (which may include, forexample, syntax elements such as used to indicate the type of predictionused, transform type, motion vectors, a quantizer value, or the like),are then output to the compressed bitstream 420. The compressedbitstream 420 can be formatted using various techniques, such asvariable length coding (VLC) or arithmetic coding. The compressedbitstream 420 can also be referred to as an encoded video stream orencoded video bitstream, and the terms will be used interchangeablyherein.

The reconstruction path (shown by the dotted connection lines) can beused to ensure that the encoder 400 and a decoder 500 (described belowwith respect to FIG. 5) use the same reference frames to decode thecompressed bitstream 420. The reconstruction path performs functionsthat are similar to functions that take place during the decodingprocess (described below with respect to FIG. 5), including dequantizingthe quantized transform coefficients at the dequantization stage 410 andinverse transforming the dequantized transform coefficients at theinverse transform stage 412 to produce a derivative residual block (alsocalled a derivative residual). At the reconstruction stage 414, theprediction block that was predicted at the intra/inter prediction stage402 can be added to the derivative residual to create a reconstructedblock. The loop filtering stage 416 can be applied to the reconstructedblock to reduce distortion such as blocking artifacts.

Other variations of the encoder 400 can be used to encode the compressedbitstream 420. In some implementations, a non-transform based encodercan quantize the residual signal directly without the transform stage404 for certain blocks or frames. In some implementations, an encodercan have the quantization stage 406 and the dequantization stage 410combined in a common stage.

FIG. 5 is a block diagram of a decoder 500 according to implementationsof this disclosure. The decoder 500 can be implemented in the receivingstation 106, for example, by providing a computer software programstored in the memory 204. The computer software program can includemachine instructions that, when executed by a processor such as theprocessor 202, cause the receiving station 106 to decode video data inthe manner described in FIG. 5. The decoder 500 can also be implementedin hardware included in, for example, the transmitting station 102 orthe receiving station 106.

The decoder 500, similar to the reconstruction path of the encoder 400discussed above, includes in one example the following stages to performvarious functions to produce an output video stream 516 from thecompressed bitstream 420: an entropy decoding stage 502, adequantization stage 504, an inverse transform stage 506, an intra/interprediction stage 508, a reconstruction stage 510, a loop filtering stage512, and a deblocking filtering stage 514. Other structural variationsof the decoder 500 can be used to decode the compressed bitstream 420.

When the compressed bitstream 420 is presented for decoding, the dataelements within the compressed bitstream 420 can be decoded by theentropy decoding stage 502 to produce a set of quantized transformcoefficients. The dequantization stage 504 dequantizes the quantizedtransform coefficients (e.g., by multiplying the quantized transformcoefficients by the quantizer value), and the inverse transform stage506 inverse transforms the dequantized transform coefficients to producea derivative residual that can be identical to that created by theinverse transform stage 412 in the encoder 400. Using header informationdecoded from the compressed bitstream 420, the decoder 500 can use theintra/inter prediction stage 508 to create the same prediction block aswas created in the encoder 400 (e.g., at the intra/inter predictionstage 402).

At the reconstruction stage 510, the prediction block can be added tothe derivative residual to create a reconstructed block. The loopfiltering stage 512 can be applied to the reconstructed block to reduceblocking artifacts. Other filtering can be applied to the reconstructedblock. In this example, the deblocking filtering stage 514 is applied tothe reconstructed block to reduce blocking distortion, and the result isoutput as the output video stream 516. The output video stream 516 canalso be referred to as a decoded video stream, and the terms will beused interchangeably herein. Other variations of the decoder 500 can beused to decode the compressed bitstream 420. In some implementations,the decoder 500 can produce the output video stream 516 without thedeblocking filtering stage 514.

Techniques for encoding or decoding video blocks are now described withrespect to FIGS. 6 and 7. FIG. 6 is a flowchart diagram of an example ofa technique 600 for encoding a video block using a selected predictionscheme. FIG. 7 is a flowchart diagram of an example of a technique 700for decoding an encoded block using a selected prediction scheme. One orboth of the technique 600 or the technique 700 can be implemented, forexample, as a software program that may be executed by computing devicessuch as the transmitting station 102 or the receiving station 106. Forexample, the software program can include machine-readable instructionsthat may be stored in a memory such as the memory 204 or the secondarystorage 214, and that, when executed by a processor, such as theprocessor 202, may cause the computing device to perform the technique600 and/or the technique 700. One or both of the technique 600 or thetechnique 700 can be implemented using specialized hardware or firmware.As explained above, some computing devices may have multiple memories orprocessors, and the operations described in one or both of the technique600 or the technique 700 can be distributed using multiple processors,memories, or both.

For simplicity of explanation, the technique 600 and the technique 700are each depicted and described as a series of steps or operations.However, the steps or operations in accordance with this disclosure canoccur in various orders and/or concurrently. Additionally, other stepsor operations not presented and described herein may be used.Furthermore, not all illustrated steps or operations may be required toimplement a technique in accordance with the disclosed subject matter.

Referring first to FIG. 6, a flowchart diagram of a technique 600 forencoding a video block using a selected prediction scheme is shown. At602, a first compound motion block is determined by weighting distancesfrom a first reference frame to the video frame and from a secondreference frame to the video frame using one or more quantized weightingcoefficients. The first reference frame and the second reference framemay be past frames (e.g., frames that appear before the current videoframe in a display order) or future frames (e.g., frames that appearafter the current video frame in the display order). For example, thefirst reference frame can be a past frame and the second reference framecan be a future frame. In another example, the first reference frame andthe second reference frame can both be past frames. In yet anotherexample, the first reference frame and the second reference frame canboth be future frames.

Determining the first compound motion block can include determining afirst quantized weighting coefficient and a second quantized weightingcoefficient by comparing a first distance from the first reference frameto the video frame to a second distance from the second reference frameto the video frame. The compared values of the first distance and thesecond distance may, for example, be absolute values of the firstdistance and the second distance. The first quantized weightingcoefficient and the second quantized weighting coefficient are quantizedbased on the comparing and the first compound motion block is determinedusing the first quantized weighting coefficient and the second quantizedweighting coefficient. For example, as described below with respect toFIG. 9, each of the first quantized weighting coefficient and the secondquantized weighting coefficient may be a value of 1, 2, 3, or 4. Inanother example, the first quantized weighting coefficient and thesecond quantized weighting coefficient may be to other values thatdemonstrate a relationship between the first distance and the seconddistance.

Determining the first quantized weighting coefficient and the secondquantized weighting coefficient by comparing the first distance to thesecond distance can include determining whether the first distance isgreater than or less than the second distance. Responsive to determiningthat the first distance is greater than the second distance, the firstquantized weighting coefficient may be determined to have a value of 1and the second quantized weighting coefficient has a value of atleast 1. Responsive to determining that the first distance is less thanthe second distance, the first quantized weighting coefficient may bedetermined to have a value of at least 1 and the second quantizedweighting coefficient has a value of 1.

The first compound motion block may, for example, be determined asCMB=((Ref1_MB*a))+(Ref2_MB*b))/(a+b), where Ref1_MB is a block of pixelvalues of the first reference frame usable to predict motion within thecurrent video block, Ref2_MB is a block of pixel values of the secondreference frame usable to predict motion within the current video block,a is the value determined by applying the first quantized weightingcoefficient to the distance between the first reference frame and thecurrent video frame, and b is the value determined by applying thesecond quantized weighting coefficient to the distance between thesecond reference frame and the current video frame.

That is, a first value can be determined by applying the first quantizedweighting coefficient against pixel values from a video block of thefirst reference frame. A second value can be determined by applying thesecond quantized weighting coefficient against pixel values from a videoblock of the second reference frame. The first compound motion block maythen be determined by dividing a sum of the first value and the secondvalue by a sum of the first quantized weighting coefficient and thesecond quantized weighting coefficient.

At 604, a second compound motion block is determined based on an averageof pixel values from a video block of the first reference frame andpixel values from a video block of the second reference frame. Forexample, determining an average of pixel values from a video block ofthe first reference frame and pixel values from a video block of thesecond reference frame can include summing pixel values in correspondingpositions of the two video blocks and then dividing those summed pixelvalues by two. In another example, determining the average of pixelvalues from a video block of the first reference frame and pixel valuesfrom a video block of the second reference frame can include weightingall or a portion of the pixel values from the video block of the firstreference frame or the second reference frame before determining theaverage thereof.

At 606, one of the first compound motion block or the compound motionblock is selected. Selecting the one of the first compound motion blockor the second compound motion block includes determining rate-distortionvalues resulting from predicting motion of the current block using eachof the first compound motion block and the second compound motion block.Those rate-distortion values may be determined by performing arate-distortion analysis based on the first compound motion block andthe second compound motion block. For example, a first rate-distortionvalue can be determined for the first compound motion block and a secondrate-distortion value can be determined for the second compound motionblock. The one of the first compound motion block or the second compoundmotion block resulting in a lower one of the rate-distortion values isthen selected. For example, performing the rate-distortion analysis caninclude comparing the first rate-distortion value and the secondrate-distortion value.

A rate-distortion value refers to a ratio that balances an amount ofdistortion (e.g., a loss in video quality) with rate (e.g., a number ofbits) for coding a block or other video component. As such, theprediction scheme that minimizes the rate-distortion value to encode thevideo block is selected for encoding the current block. For example,when the rate-distortion value for the first compound motion block(e.g., the distance-based prediction scheme) is higher than therate-distortion value for the second compound motion block (e.g., theaveraging-based prediction scheme), it may reflect that the motionbetween the reference frames and the current video frame is relativelylow. However, when the rate-distortion value for the first compoundmotion block is lower than the rate-distortion value for the secondcompound motion block, it may reflect that the motion between thereference frames and the current video frame is relatively high.

At 608, a prediction block is generated using the selected one of thefirst compound motion block or the second compound motion block. Theprediction block can include pixel values indicating a prediction of themotion of the current block according to the selected one of the firstcompound motion block or the second compound motion block. Generatingthe prediction block can include generating a prediction residual basedon a difference between the current block and the prediction block. Forexample, the prediction residual can be generated using operationsperformed by the encoder 400 shown in FIG. 4 (e.g., at the intra/interprediction stage 402). At 610, the current block is encoded using theprediction block. For example, encoding the current block using theprediction block can include transforming, quantizing, and entropyencoding the prediction residual to an encoded bitstream (e.g., thecompressed bitstream 420 shown in FIG. 4).

In some implementations, the technique 600 includes encoding one or moresyntax elements indicative of the selection of the first compound motionblock or the second compound motion block to a bitstream to which thecurrent block is encoded. For example, For example, the one or moresyntax elements may include a bit. The value of the bit can indicate theprediction scheme associated with the motion vector used to encode thecurrent block. For example, when the first compound motion block, andtherefore the distance-based prediction scheme, is used, the value ofthe bit may be zero. When the second compound motion block, andtherefore the averaging-based prediction scheme, is used, the value ofthen bit may be one. The one or more syntax elements may be encoded to aframe header of the video frame including the current block that wasencoded.

In some implementations, the technique 600 can include using more thantwo reference frames. For example, when three reference frames are used,the first compound motion block can be determined by weighting thedistance between a first one of the reference frames and the currentvideo frame using a first quantized weighting coefficient, weighting thedistance between a second one of the reference frames and the currentvideo frame using a second quantized weighting coefficient, andweighting the distance between a third one of the reference frames andthe current video frame using a third quantized weighting coefficient.

The compound motion block to use for predicting motion in the currentvideo block using these three reference frames may, for example, bedetermined asCMB=((Ref1_MB*(1/a))+(Ref2_MB*(1/b))+(Ref3_MB*(1/c)))/((1/a)+(1/b)+(1/c)),where Ref1_MB is a block of pixel values of the first reference frameusable to predict motion in the current video block, Ref2_MB is a blockof pixel values of the second reference frame usable to predict motionin the current video block, Ref3_MB is a block of pixel values of thirdreference frame usable to predict motion in the current video block, ais the value determined by applying the first quantized weightingcoefficient to the distance between the first reference frame and thecurrent video frame, b is the value determined by applying the secondquantized weighting coefficient to the distance between the secondreference frame and the current video frame, and c is the valuedetermined by applying the third quantized weighting coefficient to thedistance between the third reference frame and the current video frame.

In some implementations, the technique 600 can include updating aprobability model associated with the video frame to indicate whether adistance-based prediction scheme (e.g., the first compound motion block)or an averaging-based prediction scheme (e.g., the second compoundmotion block) was selected for predicting motion of the current block.For example, a context for the prediction scheme of the current blockcan be determined based on contexts of one or more of an above neighborblock of the current block or a left neighbor block of the currentblock, which contexts indicate the prediction scheme selected forencoding those neighbor blocks. The context for a given block of thevideo frame can have a first value indicating that a distance-basedprediction scheme was used or a second value indicating that anaveraging-based prediction scheme was used. The probability model can beupdated to reflect probabilities of each of those prediction schemesbeing used.

Referring next to FIG. 7, a technique 700 for decoding an encoded blockusing a selected prediction scheme is shown. At 702, one or more syntaxelements are decoded from a bitstream including an encoded video frame,which encoded video frame includes the encoded block. The one or moresyntax elements may be decoded, for example, from a frame header for theencoded video frame. The one or more syntax elements may have beenencoded to the encoded bitstream to indicate whether an encoder used toencode the encoded block selected a distance-based predictions scheme oran averaging-based prediction scheme to predict motion for the encodedblock before it was encoded.

At 704, a determination is made as to whether the encoded block wasencoded by weighting distances from each of a plurality of referenceframes to the encoded video frame. The determination can be made basedon the value or values of the one or more syntax elements decoded fromthe bitstream including the encoded frame. For example, the decodedsyntax elements may include one bit. When the bit has a first value(e.g., 0), it can be determined that the encoded block was encoded byweighting distances from each of a plurality of reference frames to theencoded video frame. However, when the bit has a second value (e.g., 1),it can be determined that the encoded block was not encoded by weightingdistances from each of a plurality of reference frames to the encodedvideo frame.

At 706, responsive to determining that the encoded block was encoded byweighting the distances from each of the plurality of reference framesto the encoded video frame, a compound motion block is determined byweighting a first distance from a first reference frame to the encodedvideo frame and a second distance from a second reference frame to theencoded video frame using one or more quantized weighting coefficients.As described above, the first reference frame and the second referenceframe may be past frames (e.g., frames that appear before the currentvideo frame in a display order) or future frames (e.g., frames thatappear after the current video frame in the display order).

The compound motion block can be determined at 706 in the same or asimilar way as in the implementations for determining the first compoundmotion block described with respect to the technique 600. However,whereas an encoder performing the technique 600 receives informationindicating the display order of the video sequence including the videoframe, the first reference frame, and the second reference frame from aninput video stream, a decoder performing the technique 700 does notreceive that information from an input video stream.

Instead, an order of encoded video frames of the video sequenceincluding the encoded video frame, the first reference frame, and thesecond reference frame can be indicated within the bitstream includingthe encoded video frame (and, for example, the previously-decoded one ormore syntax elements). For example, the encoded bitstream may includedata indicating frame indexes for each of the video frames encoded tothe encoded bitstream. Those frame indexes may be used, either on theirown or in connection with other data (e.g., packet stamp data, othertemporal offset data, or the like), by a decoder performing thetechnique 700 to determine the display order for the video sequence.

Alternatively, at 708, responsive to determining that the encoded blockwas not encoded by weighting the distances using the one or morequantized weighting coefficients, a compound motion block is determinedbased on an average of pixel values of an encoded video block of thefirst reference frame and pixel values of an encoded video block of thesecond reference frame. The compound motion block can be determined at708 in the same or a similar way as in the implementations fordetermining the second compound motion block described with respect tothe technique 600.

At 710, a prediction block is generated using the compound motion blockdetermined at 706 or at 708. As described above with respect to thetechnique 600, the prediction block can include pixel values indicatinga prediction of the motion of the encoded block according to thedetermined compound motion block. Generating the prediction block caninclude generating a prediction residual based on a difference betweenthe encoded block and the prediction block. For example, the predictionresidual can be generated using operations performed by the decoder 500shown in FIG. 5 (e.g., at the intra/inter prediction stage 508). At 712,the encoded block is decoded using the prediction block. For example,decoding the encoded block using the prediction block can includereconstructing the video block based on the prediction residual,filtering the reconstructed video block, and outputting the filteredvideo block to a video stream (e.g., the output video stream 516 shownin FIG. 5).

In some implementations, the technique 700 can include using more thantwo reference frames. For example, the technique 700 can use a samenumber of reference frames to decode the encoded block as an encoderused to encode the encoded block. Implementations for using more thantwo reference frames are described above with respect to the technique600.

In some implementations, the technique 700 can include updating aprobability model associated with the encoded video frame to indicatewhether a compound motion block corresponding to a distance-basedprediction scheme (e.g., the first compound motion block) or a compoundmotion block corresponding to an averaging-based prediction scheme(e.g., the second compound motion block) was selected for predictingmotion of the encoded block. Implementations for updating a probabilitymodel are described above with respect to the technique 600.

FIG. 8 is an illustration of an example of distances between frames of avideo sequence. A video frame 800 includes a video block 802 to beencoded or decoded. The video block 802 may be encoded or decoded usinga first reference frame 804 and a second reference frame 806. Forexample, all or a portion of the pixel values of a video block 808 ofthe first reference frame may be combined with all or a portion of thepixel values of a video block 810 of the second reference frame. Thecombination of those pixel values may be based on the distance 1 812indicating the distance in display order between the first referenceframe 804 and the video frame 800 and based on the distance 2 814indicating the distance in display order between the second referenceframe 806 and the video frame 800.

In the event that the distance 1 812 and the distance 2 814 are equal,the pixel values of the video block 808 and the pixel values of thevideo block 810 may be equally combined to predict the motion in thevideo block 802. However, one of the distance 1 812 and the distance 2814 may be greater than the other. In such a case, the more distant ofthe two reference frames 804, 806 from the video frame 800 likely has adiminishing impact on the overall prediction of the motion for the videoblock 802. In the example shown, the distance 2 814 is greater than thedistance 1 812. As such, the respective pixel values of the video block808 of the first reference frame should be given more weight than therespective pixel values of the video block 810 of the second referenceframe when those pixel values are combined to predict the motion of thevideo block 802.

FIG. 9 is a diagram of an example of a tree 900 for determiningquantized weighted coefficients. When using a distance-based predictionscheme for compound motion prediction as described in implementations ofthis disclosure, determining how to weight pixel values from each of thereference frames helps to conceal the quantization noise presented byeach of those reference frames. To further reduce quantization noise,the weights applied to the pixel values from each of the referenceframes are quantized coefficients. The quantized weighting coefficientsapplied against each of the groups of pixel values of the referenceframes can be determined based on comparisons between the distancesbetween each of those reference frames and the video frame including thevideo block to be encoded or decoded.

In the example shown, each leaf of the tree 900 includes either acomparison of a distance D1 (e.g., the distance 1 812 shown in FIG. 8)and a distance D2 (e.g., the distance 2 814 shown in FIG. 8) or a pairof quantized weighting coefficients for predicting the motion of thevideo block using pixel values from the first reference frame and thesecond reference frame. As described above, the compared values of D1and D2 may, for example, be absolute values of D1 and D2.

At a first leaf, D1 and D2 are compared to determine which is larger.Based on that comparison, the tree 900 further compares ratios of D1 andD2 against different values to determine one of eight different possiblepairs of quantized weighting coefficients, where each pair includes afirst quantized weighting coefficient applied against pixel values of avideo block of the first reference frame and a second quantizedweighting coefficient applied against pixel values of a video block ofthe second reference frame.

For example, if D1 is greater than D2 and the ratio of D1 over D2 isless than 1.5, the first quantized weighting coefficient is 1 and thesecond quantized weighting coefficient is 1. If D1 is greater than D2and the ratio of D1 over D2 is greater than or equal to 1.5 and lessthan 2.5, the first quantized weighting coefficient is 1 and the secondquantized weighting coefficient is 2. If D1 is greater than D2 and theratio of D1 over D2 is greater than or equal to 2.5 and less than 3.5,the first quantized weighting coefficient is 1 and the second quantizedweighting coefficient is 3. However, if D1 is greater than D2 and theratio of D1 over D2 is greater than or equal to 3.5, the first quantizedweighting coefficient is 1 and the second quantized weightingcoefficient is 4.

In another example, if D2 is greater than D1 and the ratio of D2 over D1is less than 1.5, the first quantized weighting coefficient is 1 and thesecond quantized weighting coefficient is 1. If D2 is greater than D1and the ratio of D2 over D1 is greater than or equal to 1.5 and lessthan 2.5, the first quantized weighting coefficient is 2 and the secondquantized weighting coefficient is 1. If D2 is greater than D1 and theratio of D2 over D1 is greater than or equal to 2.5 and less than 3.5,the first quantized weighting coefficient is 3 and the second quantizedweighting coefficient is 1. However, if D2 is greater than D1 and theratio of D2 over D1 is greater than or equal to 3.5, the first quantizedweighting coefficient is 4 and the second quantized weightingcoefficient is 1.

Accordingly, the values of the first quantized weighting coefficient andthe second quantized weighting coefficient demonstrate a relationshipbetween the first distance between the first reference frame and thecurrent video frame and the second distance between the second referenceframe and the current video frame. For example, if the ratio of thefirst distance and the second distance indicates that the first distanceis twice as large as the second distance, the first quantized weightingcoefficient will have a value of 2 and the second quantized weightingcoefficient will have a value of 1. In another example, if the ratio ofthe first distance and the second distance indicates that the seconddistance is four or more times larger than the second distance, thefirst quantized weighting coefficient will have a value of 1 and thesecond quantized weighting coefficient will have a value of 4.

The aspects of encoding and decoding described above illustrate someexamples of encoding and decoding techniques. However, it is to beunderstood that encoding and decoding, as those terms are used in theclaims, could mean compression, decompression, transformation, or anyother processing or change of data.

The word “example” is used herein to mean serving as an example,instance, or illustration. Any aspect or design described herein as“example” is not necessarily to be construed as being preferred oradvantageous over other aspects or designs. Rather, use of the word“example” is intended to present concepts in a concrete fashion. As usedin this application, the term “or” is intended to mean an inclusive “or”rather than an exclusive “or.” That is, unless specified otherwise orclearly indicated otherwise by the context, the statement “X includes Aor B” is intended to mean any of the natural inclusive permutationsthereof. That is, if X includes A; X includes B; or X includes both Aand B, then “X includes A or B” is satisfied under any of the foregoinginstances. In addition, the articles “a” and “an” as used in thisapplication and the appended claims should generally be construed tomean “one or more,” unless specified otherwise or clearly indicated bythe context to be directed to a singular form. Moreover, use of the term“an implementation” or the term “one implementation” throughout thisdisclosure is not intended to mean the same embodiment or implementationunless described as such.

Implementations of the transmitting station 102 and/or the receivingstation 106 (and the algorithms, methods, instructions, etc., storedthereon and/or executed thereby, including by the encoder 400 and thedecoder 500) can be realized in hardware, software, or any combinationthereof. The hardware can include, for example, computers, intellectualproperty (IP) cores, application-specific integrated circuits (ASICs),programmable logic arrays, optical processors, programmable logiccontrollers, microcode, microcontrollers, servers, microprocessors,digital signal processors, or any other suitable circuit. In the claims,the term “processor” should be understood as encompassing any of theforegoing hardware, either singly or in combination. The terms “signal”and “data” are used interchangeably. Further, portions of thetransmitting station 102 and the receiving station 106 do notnecessarily have to be implemented in the same manner.

Further, in one aspect, for example, the transmitting station 102 or thereceiving station 106 can be implemented using a general purposecomputer or general purpose processor with a computer program that, whenexecuted, carries out any of the respective methods, algorithms, and/orinstructions described herein. In addition, or alternatively, forexample, a special purpose computer/processor can be utilized which cancontain other hardware for carrying out any of the methods, algorithms,or instructions described herein.

The transmitting station 102 and the receiving station 106 can, forexample, be implemented on computers in a video conferencing system.Alternatively, the transmitting station 102 can be implemented on aserver, and the receiving station 106 can be implemented on a deviceseparate from the server, such as a handheld communications device. Inthis instance, the transmitting station 102, using an encoder 400, canencode content into an encoded video signal and transmit the encodedvideo signal to the communications device. In turn, the communicationsdevice can then decode the encoded video signal using a decoder 500.Alternatively, the communications device can decode content storedlocally on the communications device, for example, content that was nottransmitted by the transmitting station 102. Other suitable transmittingand receiving implementation schemes are available. For example, thereceiving station 106 can be a generally stationary personal computerrather than a portable communications device, and/or a device includingan encoder 400 may also include a decoder 500.

Further, all or a portion of implementations of the present disclosurecan take the form of a computer program product accessible from, forexample, a computer-usable or computer-readable medium. Acomputer-usable or computer-readable medium can be any device that can,for example, tangibly contain, store, communicate, or transport theprogram for use by or in connection with any processor. The medium canbe, for example, an electronic, magnetic, optical, electromagnetic, orsemiconductor device. Other suitable mediums are also available.

The above-described embodiments, implementations, and aspects have beendescribed in order to facilitate easy understanding of this disclosureand do not limit this disclosure. On the contrary, this disclosure isintended to cover various modifications and equivalent arrangementsincluded within the scope of the appended claims, which scope is to beaccorded the broadest interpretation as is permitted under the law so asto encompass all such modifications and equivalent arrangements.

What is claimed is:
 1. A method for encoding a current block of a videoframe, the method comprising: determining a first compound motion blockby: determining a pair of quantized weighting coefficients based on aratio of a first distance and a second distance, the first distancerepresenting a distance from a first reference frame to the video frame,the second distance representing a distance from a second referenceframe to the video frame, the pair of quantized weighting coefficientsincluding a first quantized weighting coefficient and a second quantizedweighting coefficient; determining a first value by applying the firstquantized weighting coefficient to pixel values from a video block ofthe first reference frame; determining a second value by applying thesecond quantized weighting coefficient to pixel values from a videoblock of the second reference frame; and determining the first compoundmotion block by dividing a sum of the first value and the second valueby a sum of the first quantized weighting coefficient and the secondquantized weighting coefficient; determining a second compound motionblock based on an average of the pixel values from the video block ofthe first reference frame and the pixel values from the video block ofthe second reference frame; selecting one of the first compound motionblock or the second compound motion block; generating a prediction blockusing the selected one of the first compound motion block or the secondcompound motion block; and encoding the current block using theprediction block.
 2. The method of claim 1, wherein, when the firstdistance is greater than the second distance, the first quantizedweighting coefficient has a value of 1 and the second quantizedweighting coefficient has a value of at least 1, and, when the firstdistance is less than the second distance, the first quantized weightingcoefficient has a value of at least 1 and the second quantized weightingcoefficient has a value of
 1. 3. The method of claim 1, whereinselecting the one of the first compound motion block or the secondcompound motion block comprises: determining rate-distortion valuesresulting from predicting motion of the current block using motionvectors associated with each of the first compound motion block and thesecond compound motion block; and selecting the one of the firstcompound motion block or the second compound motion block resulting in alower one of the rate-distortion values.
 4. The method of claim 1,further comprising: encoding one or more syntax elements indicative ofthe selection of the first compound motion block or the second compoundmotion block to a bitstream to which the current block is encoded.
 5. Amethod for decoding an encoded block of an encoded video frame, themethod comprising: determining, based on one or more syntax elementsencoded to a bitstream including the encoded video frame, whether theencoded block was encoded by weighting distances from each of aplurality of reference frames to the encoded video frame; responsive todetermining that the encoded block was encoded by weighting thedistances from each of the plurality of reference frames to the encodedvideo frame, determining a compound motion block by: determining a pairof quantized weighting coefficients based on a ratio of a first distanceand a second distance, the first distance representing a distance from afirst reference frame of the plurality of reference frames to theencoded video frame, the second distance representing a distance from asecond reference frame of the plurality of reference frames to theencoded video frame, the pair of quantized weighting coefficientsincluding a first quantized weighting coefficient and a second quantizedweighting coefficient; determining a first value by applying the firstquantized weighting coefficient to pixel values from a video block ofthe first reference frame; determining a second value by applying thesecond quantized weighting coefficient to pixel values from a videoblock of the second reference frame; and determining the first compoundmotion block by dividing a sum of the first value and the second valueby a sum of the first quantized weighting coefficient and the secondquantized weighting coefficient; generating a prediction block using thecompound motion block; and decoding the encoded block using theprediction block.
 6. The method of claim 5, wherein, when the firstdistance is greater than the second distance, the first quantizedweighting coefficient has a value of 1 and the second quantizedweighting coefficient has a value of at least 1, and, when the firstdistance is less than the second distance, that the first quantizedweighting coefficient has a value of at least 1 and the second quantizedweighting coefficient has a value of
 1. 7. The method of claim 5,wherein the compound motion block is a first compound motion block andthe prediction block is a first prediction block, the method furthercomprising: responsive to determining that the encoded block was notencoded by weighting the distances using the one or more quantizedweighting coefficients, determining a second compound motion block basedon an average of pixel values from an encoded video block of the firstreference frame and pixel values from an encoded video block of thesecond reference frame; generating a second prediction block using thesecond compound motion block; and decoding the encoded block using thesecond prediction block.
 8. The method of claim 5, further comprising:decoding the one or more syntax elements from the bitstream prior todetermining whether the encoded block was encoded by weighting thedistances from each of the plurality of reference frames to the encodedvideo frame.
 9. The method of claim 5, wherein an order of encoded videoframes of a video sequence including the encoded video frame, the firstreference frame, and the second reference frame is indicated within thebitstream.
 10. An apparatus for decoding an encoded block of an encodedvideo frame, the apparatus comprising: a processor configured to executeinstructions stored in a non-transitory memory to: determine, based onone or more syntax elements encoded to a bitstream including the encodedvideo frame, whether the encoded block was encoded by weightingdistances from each of a plurality of reference frames to the encodedvideo frame; responsive to a determination that the encoded block wasencoded by weighting the distances from each of the plurality ofreference frames to the encoded video frame, determine a compound motionblock by applying a first quantized weighting coefficient to pixelvalues from a video block of a first reference frame of the plurality ofreference frames and by applying a second quantized weightingcoefficient to pixel values from a video block of a second referenceframe of the plurality of reference frames, the first quantizedweighting coefficient and the second quantized weighting coefficientdetermined based on a ratio of a first distance and a second distance,the first distance representing a distance from the first referenceframe to the encoded video frame, the second distance representing adistance from the second reference frame to the encoded video frame;generate a prediction block using the compound motion block; and decodethe encoded block using the prediction block.
 11. The apparatus of claim10, wherein, when the first distance is greater than the seconddistance, determine that the first quantized weighting coefficient has avalue of 1 and the second quantized weighting coefficient has a value ofat least 1, and, when the first distance is less than the seconddistance, the first quantized weighting coefficient has a value of atleast 1 and the second quantized weighting coefficient has a value of 1.12. The apparatus of claim 10, wherein the instructions to determine thecompound motion block include instructions to: determine a first valueby applying the first quantized weighting coefficient against pixelvalues from the video block of the first reference frame; and determinea second value by applying the second quantized weighting coefficientagainst pixel values from the video block of the second reference frame,wherein the compound motion block is determined by dividing a sum of thefirst value and the second value by a sum of the first quantizedweighting coefficient and the second quantized weighting coefficient.13. The apparatus of claim 10, wherein the compound motion block is afirst compound motion block and the prediction block is a firstprediction block, wherein the instructions include instructions to:responsive to a determination that the encoded block was not encoded byweighting the distances using the one or more quantized weightingcoefficients, determine a second compound motion block based on anaverage of pixel values from an encoded video block of the firstreference frame and pixel values from an encoded video block of thesecond reference frame; generate a second prediction block using thesecond compound motion block; and decode the encoded block using thesecond prediction block.
 14. The apparatus of claim 10, wherein theinstructions include instructions to: decode the one or more syntaxelements from the bitstream prior to the determination as to whether theencoded block was encoded by weighting the distances from each of theplurality of reference frames to the encoded video frame.
 15. Theapparatus of claim 10, wherein an order of encoded video frames of avideo sequence including the encoded video frame, the first referenceframe, and the second reference frame is indicated within the bitstream.16. The method of claim 1, wherein, when the first distance is greaterthan the second distance, the ratio is a first ratio of the firstdistance over the second distance, and, when the first distance is notgreater than the second distance, the ratio is a second ratio of thesecond distance over the first distance.
 17. The method of claim 16,wherein, when the first ratio or the second ratio is less than 1.5, thefirst quantized weighting coefficient and the second quantized weightingcoefficient are both equal to 1, wherein, when the first ratio isgreater than 1.5 and less than 2.5, the first quantized weightingcoefficient is 1 and the second quantized weighting coefficient is 2,wherein, when the first ratio is greater than 2.5 and less than 3.5, thefirst quantized weighting coefficient is 1 and the second quantizedweighting coefficient is 3, wherein, when the first ratio is greaterthan 3.5, the first quantized weighting coefficient is 1 and the secondquantized weighting coefficient is 4, wherein, when the second ratio isgreater than 1.5 and less than 2.5, the first quantized weightingcoefficient is 2 and the second quantized weighting coefficient is 1,wherein, when the second ratio is greater than 2.5 and less than 3.5,the first quantized weighting coefficient is 3 and the second quantizedweighting coefficient is 1, wherein, when the second ratio is greaterthan 3.5, the first quantized weighting coefficient is 4 and the secondquantized weighting coefficient is
 1. 18. The method of claim 5,wherein, when the first distance is greater than the second distance,the ratio is a first ratio of the first distance over the seconddistance, and, when the first distance is not greater than the seconddistance, the ratio is a second ratio of the second distance over thefirst distance.
 19. The method of claim 18, wherein, when the firstratio or the second ratio is less than 1.5, the first quantizedweighting coefficient and the second quantized weighting coefficient areboth equal to 1, wherein, when the first ratio is greater than 1.5 andless than 2.5, the first quantized weighting coefficient is 1 and thesecond quantized weighting coefficient is 2, wherein, when the firstratio is greater than 2.5 and less than 3.5, the first quantizedweighting coefficient is 1 and the second quantized weightingcoefficient is 3, wherein, when the first ratio is greater than 3.5, thefirst quantized weighting coefficient is 1 and the second quantizedweighting coefficient is 4, wherein, when the second ratio is greaterthan 1.5 and less than 2.5, the first quantized weighting coefficient is2 and the second quantized weighting coefficient is 1, wherein, when thesecond ratio is greater than 2.5 and less than 3.5, the first quantizedweighting coefficient is 3 and the second quantized weightingcoefficient is 1, wherein, when the second ratio is greater than 3.5,the first quantized weighting coefficient is 4 and the second quantizedweighting coefficient is
 1. 20. The apparatus of claim 10, wherein, whenthe first distance is greater than the second distance, the ratio is aratio of the first distance over the second distance, and, when thefirst distance is not greater than the second distance, the ratio is aratio of the second distance over the first distance.